import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex);

export const store = new Vuex.Store({
  state: {
    login: true,
    form:null,
    basedata_store:null,
    zc_form:false,
    zc_formshow:false
  },
  getters: {
    login: state => {
      return state.login
    },
    zc_form: state => {
      return state.zc_form
    },
    zc_formshow: state => {
      return state.zc_formshow
    },
    form: state => {
      return state.form
    },
    basedata_store: state => {
      return state.basedata_store
    }
  },
  mutations: {
    checkLogin: (state, payload) => {
      state.login = payload;
    },
    checkzc_form: (state, payload) => {
      state.zc_form = payload;
    },
    checkzc_formshow: (state, payload) => {
      state.zc_formshow = payload;
    },
    checkForm: (state, text) => {
      state.form = text;
    },
    checkbasedata_store: (state, text) => {
      state.basedata_store = text;
    },
    changeLogin:()=>{
      this.login=false
    }
  },
  actions: {
    checkLogin: ({ commit }, payload) => {
      commit('checkLogin', payload);
    },
    checkzc_form: ({ commit }, payload) => {
      commit('checkzc_form', payload);
    },
    checkzc_formshow: ({ commit }, payload) => {
      commit('checkzc_formshow', payload);
    },
    checkForm: ({ commit }, text) => {
      commit('checkForm', text);
    },
    checkbasedata_store: ({ commit }, text) => {
      commit('checkbasedata_store', text);
    }
  }
})